Writes text to a specific line in a file.
#include <File.au3>
_FileWriteToLine($sFile, $iLine, $sText[, $fOverWrite])
Parameters
$sFile | The file to write to |
$iLine | The line number to write to |
$sText | The text to write |
$fOverWrite | if set to 1 will overwrite the old line if set to 0 will not overwrite |
Return Value
Success: | 1 |
Failure: | 0 |
@Error: | 0 = No error |
1 = File has less lines than $iLine | |
2 = File does not exist | |
3 = Error when opening file | |
4 = $iLine is invalid | |
5 = $fOverWrite is invalid | |
6 = $sText is invalid |
Remarks
If _FileWriteToLine is called with $fOverWrite as 1 and $sText as "", it will delete the line.
Related
None.
Example
#include <File.au3>
;Example: Write to line 3 of c:\test.txt REPLACING line 3
_FileWriteToLine("c:\test.txt", 3, "my replacement for line 3", 1)
;Example: Write to line 3 of c:\test.txt NOT REPLACING line 3
_FileWriteToLine("c:\test.txt", 3, "my insertion", 0)